#include "cot_os.h"
#include <stdio.h>


#ifdef _WIN32
#include <windows.h>
size_t GetTimerMs(void) 
{
    return GetTickCount();
}
#else
#include <sys/time.h>
size_t GetTimerMs(void) 
{
    struct timeval tv;
    gettimeofday(&tv, NULL);
    return (size_t)(tv.tv_sec) * 1000 + (size_t)(tv.tv_usec) / 1000;
}
#endif

void taskfunc1(void)
{
    while(1)
    {
        printf("taskfunc-1-0\n");
        cotOs_WaitFor(1000);
    }
}


void taskfunc2(void)
{
    while(1)
    {
        printf("taskfunc-2-0\n");
        cotOs_WaitFor(3000);
    }
}

int main(void)
{
    cotOs_Init(10240, GetTimerMs);
    cotOs_Creat(taskfunc1, 10240);
    cotOs_Creat(taskfunc2, 10240);
    
    cotOs_Start();

    return 0;
}
